//package autoFile.core.strategy;
//
//import autoFile.core.strategy.interfaces.CreateFileStrategyInterface;
//import com.google.common.base.CaseFormat;
//
//import java.io.FileWriter;
//import java.io.IOException;
//import java.lang.reflect.Method;
//import java.util.List;
//
///**
// * Created by IntelliJ IDEA.
// * User: liuliwei
// * Date: 2017-08-16
// * Time: 下午5:02
// * Description: ${description}
// */
//public class CreateUserProxyFileStrategy extends AbstractStrategy implements CreateFileStrategyInterface{
//
//    @Override
//    public void createFile(Class clazz) throws IOException {
//        String userProxyTemplate = getUserProxyTemplate();
//        String userProxyMethodTemplate= getUserProxyMethodTemplate();
//        String className = clazz.getSimpleName(); //类名称
//        String classNameSmall = CaseFormat.UPPER_CAMEL.converterTo(CaseFormat.LOWER_CAMEL).convert(className); //类名称小写
//        String targetClassName = className + "RpcProxy";//生成文件名称
//        String classNameWithService = new String(className); //类名称后面有Service
//        String classNameWithServiceSmall = CaseFormat.UPPER_CAMEL.converterTo(CaseFormat.LOWER_CAMEL).convert(classNameWithService); //类名称小写后面有Service
//
//        if (className.contains("Service")) {
//            className = className.replaceFirst("Service", "");
//            classNameSmall = classNameSmall.replaceFirst("Service", "");
//        }
//        String userCommandMethodTemplates = "";
//        for (Method method : getPublicMethod(clazz)) {
//            String parameterTypeAndName = getParameterTypeAndName(method);
//            String parameterNames = getParameterNames(method);
//            String rpcConstant =getGongRpcConstant(className, method);
//            String classNameT = userProxyMethodTemplate.replace("className", classNameWithServiceSmall);
//            String methodName = classNameT.replace("methodName", method.getName());
//            String parameters = methodName.replace("parameters", parameterTypeAndName);
//            String parameterNames1 = parameters.replace("parameterNames", parameterNames);
//            String result = parameterNames1.replace("rpcConstant", rpcConstant);
//            result += "\t";
//            userCommandMethodTemplates += result;
////            createGongRpcConstants(className, method, gongRpcConstantsWriter);
//        }
//        String replaceContent = userProxyTemplate.replace("#", userCommandMethodTemplates);
//        String replace$ = replaceContent.replace("$", targetClassName);
//        String ClassName = replace$.replace("ClassName", classNameWithService);
//        String result = ClassName.replace("className", classNameWithServiceSmall);
//        String fileName = "/Users/liuliwei/autoFile/" + targetClassName + ".java";
//        FileWriter userCommandProxyWriter = new FileWriter(fileName, true);
//        System.out.println("生成"+fileName);
//        userCommandProxyWriter.write(result);
//        userCommandProxyWriter.close();
//
//    }
//
//    /**
//     * gas
//     * proxy模板
//     *
//     * @return
//     * @throws IOException
//     */
//    private static String getUserProxyTemplate() throws IOException {
//        return getTemplateByFullPath("/Users/liuliwei/autoFile/template/userProxyTemplate");
//    }
//
//    /**
//     * 得到 gas  proxy 方法模板
//     *
//     * @return
//     * @throws IOException
//     */
//    private static String getUserProxyMethodTemplate() throws IOException {
//        return getTemplateByFullPath("/Users/liuliwei/autoFile/template/userProxyMethodTemplate");
//    }
//}
